home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / machserver / 1.098 / dev / sun4c.md / devGraphics.c < prev    next >
C/C++ Source or Header  |  1990-12-18  |  32KB  |  1,191 lines

  1. /* 
  2.  * devGraphics.c --
  3.  *
  4.  *    This module provides frame buffer device support.
  5.  *
  6.  * Copyright 1989 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  */
  15.  
  16. #ifndef lint
  17. static char rcsid[] = "$Header: /sprite/src/kernel/dev/sun4.md/RCS/devGraphics.c,v 1.10 90/12/18 13:47:06 mgbaker Exp $ SPRITE (Berkeley)";
  18. #endif /* not lint */
  19.  
  20. #include "sprite.h"
  21. #include "dev.h"
  22. #include <sys/ioctl.h>
  23. #include "devfb.h"
  24. #include "fs.h"
  25. #include "vmMach.h"
  26. #include "rpc.h"
  27. #include "stdio.h"
  28. #include "sys/types.h"
  29. #include "mon/eeprom.h"
  30. #include "machMon.h"
  31. #include "stdlib.h"
  32. #include "string.h"
  33. #include "bstring.h"
  34.  
  35. #define EEC_COLOR_TYPE_CG4      4       /* missing in mon/eeprom.h */
  36. #define EEC_COLOR_TYPE_CG6      6       /* missing in mon/eeprom.h */
  37.  
  38. /*
  39.  * For BW2 frame buffer
  40.  */
  41.  
  42.  
  43. #ifdef sun3
  44. #define BW2_FB    ((void *)0x0fe20000)
  45. #elif sun4c
  46. #define BW2_FB    ((void *)0xffd80000)
  47. #elif sun4
  48. #define BW2_FB    ((void *)0xffd40000)
  49. #else
  50. #define    BW2_FB    ((void *)NIL)
  51. #endif /* sun3 */
  52.  
  53.  
  54. /*
  55.  * For CG4 frame buffer
  56.  */
  57. #ifdef sun3
  58. #define CG4_FB     ((void *)0x0fd00000)
  59. #define CG4_CM     ((void *)0x0fe0e000)
  60. #define CG4_OV     ((void *)0x0fe80000)
  61. #define CG4_EN     ((void *)0x0fea0000)
  62. #elif sun4c
  63. #define CG4_FB    ((void *)0xffd80000)
  64. #define CG4_CM    ((void *)0xffd1c000)
  65. #define CG4_OV    ((void *)0x0)           /* ??? */
  66. #define CG4_EN    ((void *)0x0)           /* ??? */
  67. #else
  68. #define CG4_FB    ((void *)NIL)
  69. #define CG4_CM    ((void *)NIL)
  70. #define CG4_OV    ((void *)NIL)
  71. #define CG4_EN    ((void *)NIL)
  72. #endif /* sun3 */
  73. /*
  74.  * For CG6 frame buffer
  75.  */
  76. #ifdef sun4c
  77. #define CG6_FB    ((void *)0xffd80000)
  78. #define CG6_CM    ((void *)0xffd1f000)
  79. #else
  80. #define CG6_FB    ((void *)NIL)
  81. #define CG6_CM    ((void *)NIL)
  82. #endif /* sun4c */
  83. /*
  84.  * CG3 frame buffer.
  85.  */
  86. #ifdef sun4c
  87. #define CG3_FB    ((void *)0xffd80000)
  88. #define CG3_CM    ((void *)0xffd1c000)
  89. #else
  90. #define CG3_FB    ((void *)0xffd80000)
  91. #define CG3_CM    ((void *)0xffd1c000)
  92. #endif /* sun4c */
  93.  
  94.  
  95. typedef    struct    FBDevice {
  96.     FBType    type;
  97.     FBInfo    info;
  98.     FBCMap    cmap;
  99. } FBDevice;
  100.  
  101. /*
  102.  * Associates a string with each fb type so we can use a hack to look up
  103.  * the type per machine from a file rather than the prom...
  104.  */
  105. char    *fbNames[FBTYPE_LASTPLUSONE] = {
  106.     "bwone",
  107.     "cgone",
  108.     "bwtwo",
  109.     "cgtwo",
  110.     "FBTYPE_SUN_GP2",
  111.     "FBTYPE_SUN_CG5",
  112.     "cgthree",
  113.     "FBTYPE_MEMCOLOR",
  114.     "cgfour",
  115.     "FBTYPE_NOTSUN1",
  116.     "FBTYPE_NOTSUN2",
  117.     "FBTYPE_NOTSUN3",
  118.     "cgsix",
  119.     "FBTYPE_SUNROP_COLOR",
  120.     "FBTYPE_SUNFB_VIDEO",
  121.     "FBTYPE_RESERVED5",
  122.     "FBTYPE_RESERVED4",
  123.     "FBTYPE_RESERVED3",
  124.     "FBTYPE_RESERVED2",
  125.     "FBTYPE_RESERVED1"
  126. };
  127.  
  128. /*
  129.  * Brooktree DAC
  130.  */
  131. volatile struct colormap {
  132.     unsigned int    addr;        /* colormap address register */
  133.     unsigned int    cmap;        /* colormap data register */
  134.     unsigned int    ctrl;        /* control register */
  135.     unsigned int    omap;        /* overlay map data register */
  136. } *fbCmap = (volatile struct colormap *) NIL;
  137.  
  138. /* Copy of colormap (for CG4 only!) */
  139. static union {
  140.         unsigned char   map[256][3];    /* reasonable way to access */
  141.         unsigned int    raw[256*3/4];   /* unreasonable way used to load h/w */
  142. } fbCmapCopy;
  143.  
  144.  
  145. /*
  146.  * Addresses to know for the different frame buffers, overlay planes, etc.
  147.  */
  148. typedef    struct FBAddr {
  149.     void    *fb_buffer;        /* kernel virtual address */
  150.     void    *fb_overlay;        /* offset? */
  151.     void    *fb_enable;        /* offset? */
  152.     void    *fb_cmap;        /* cmap */
  153. } FBAddr;
  154.  
  155. /*
  156.  * Addresses for frame buffer, overlay and enable.  This is in a separate
  157.  * array since it's different per machine type.  I only have it for
  158.  * one machine type right now (sun4c).
  159.  */
  160. FBAddr    fbaddrs[FBTYPE_LASTPLUSONE] = {
  161.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL},    /* bw1 */
  162.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL},    /* cg1 */
  163.     {BW2_FB, (void *) NULL, (void *) NULL, (void *) NULL},    /* bw2 */
  164.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL},    /* cg2 */
  165.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL},    /* gp2 */
  166.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL},    /* cg5 */
  167.     {CG3_FB, (void *) NULL, (void *) NULL, CG3_CM},        /* cg3 */
  168.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL},    /* ? */
  169.     {CG4_FB, CG4_OV, CG4_EN, CG4_CM},                /* cg4 */
  170.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL},    /* cust. */
  171.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL},    /* cust. */
  172.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL},    /* cust. */
  173.     {CG6_FB, (void *) NULL, (void *) NULL, CG6_CM},        /* cg6 */
  174.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL},    /* rop */
  175.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL},    /* video */
  176.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL},    /* res5 */
  177.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL},    /* res4 */
  178.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL},    /* res3 */
  179.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL},    /* res2 */
  180.     {(void *) NIL, (void *) NIL, (void *) NIL, (void *) NIL}    /* res1 */
  181. };
  182.  
  183.  
  184. /*
  185.  * For convenience we store info about the frame buffer types here.  If we
  186.  * get the info from the prom, we overwrite the stuff here.
  187.  * Array indexed by fb_type, found in fb.h.
  188.  * An example of what would be overwritten is if we have a high resolution
  189.  * b&w screen, the info in the prom will give us
  190.  *    {high resolution bw2, 1280, 1600, 1, 2, 256*1024},    (* bw2h *)
  191.  * instead of the regular bw2.  Also, for cg3, we could have a second type:
  192.  *    {cg3b, 768, 1024, -1, -1, -1}             (* cg3 B *)
  193.  */
  194.         /* type, height, width, depth, cmsize, size */
  195. FBType    fbarray[FBTYPE_LASTPLUSONE] = {
  196.     {FBTYPE_SUN1BW, -1, -1, -1, -1, -1},            /* bw1 */
  197.     {FBTYPE_SUN1COLOR, -1, -1, -1, -1, -1},            /* cg1 */
  198.     {FBTYPE_SUN2BW, 900, 1152, 1, 2, 128*1024},        /* bw2 */
  199.     {FBTYPE_SUN2COLOR, 900, 1152, 8, -1, -1},        /* cg2 */
  200.     {FBTYPE_SUN2GP, -1, -1, -1, -1, -1},            /* gp2 */
  201.     {FBTYPE_SUN5COLOR, -1, -1, -1, -1, -1},            /* cg5? |bw3? */
  202.     {FBTYPE_SUN3COLOR, 900, 1152, 8, 256, 1024*1024},    /* cg3 A */
  203.     {FBTYPE_MEMCOLOR, -1, -1, -1, -1, -1},            /* ? | bw4? */
  204.     {FBTYPE_SUN4COLOR, 900, 1152, 8, 256, 1024*1024},    /* cg4 */
  205.     {FBTYPE_NOTSUN1, -1, -1, -1, -1, -1},            /* customer */
  206.     {FBTYPE_NOTSUN2, -1, -1, -1, -1, -1},            /* customer */
  207.     {FBTYPE_NOTSUN3, -1, -1, -1, -1, -1},            /* customer */
  208.     {FBTYPE_SUNFAST_COLOR, 900, 1152, 8, 256, 1024*1024},    /* cg6=gx*/
  209.     {FBTYPE_SUNROP_COLOR, -1, -1, -1, -1, -1},
  210.     {FBTYPE_SUNFB_VIDEO, -1, -1, -1, -1, -1},
  211.     {FBTYPE_RESERVED5, -1, -1, -1, -1, -1},            /* don't use */
  212.     {FBTYPE_RESERVED4, -1, -1, -1, -1, -1},            /* don't use */
  213.     {FBTYPE_RESERVED3, -1, -1, -1, -1, -1},            /* don't use */
  214.     {FBTYPE_RESERVED2, -1, -1, -1, -1, -1},            /* don't use */
  215.     {FBTYPE_RESERVED1, -1, -1, -1, -1, -1}            /* don't use */
  216. };
  217.  
  218. /*
  219.  *
  220.  * Thorsten's notes for the old user-level fbio stuff:
  221.  *
  222.  *
  223.  * Brooktree DAC/colormap information
  224.  *
  225.  * Operation theory (really: guesses)
  226.  *
  227.  * The DAC has four byte size "ports" (cpu accessible registers) which have to
  228.  * be used to access the three internal register files with the 256 colormap
  229.  * RGB entries, a few control registers and 4 overlay RGB entries.
  230.  * To access a control register: write the register number (0-7?) into
  231.  * "addr" (see struct below), then write the value into "ctrl".
  232.  * To access a RGB entry: write the entry number (0-255 or 0-3) into "addr"
  233.  * then write the R, G and B values (in that order) into "cmap" or "omap".
  234.  * After the access, the "addr" is automatically incremented to allow quick
  235.  * updates of successive colormap entries.
  236.  *
  237.  * Now, this was the meat and here comes the spice:
  238.  * On the CG6 board, the ports are on (mod 4)=0 addresses and require
  239.  * longword accesses. This means the value has to go into bits 24-31 of
  240.  * an int which is then written to the chip. (Similarly for reading.)
  241.  * On the CG4 board, things are even better: the ports are on (mod 4)=3
  242.  * addresses and require longword accesses. The value can thus reside
  243.  * in the low 8 bits of an int. However, colormap RGB values behave
  244.  * wonderfully different: one longword write to "cmap" or "omap" is
  245.  * turned (by the hardware) into four byte writes to the chip, the
  246.  * top byte first, the bottom one last. (Dunno 'bout reads.) This means
  247.  * that one write to "cmap" or "omap" writes 4/3 colormap RGB entries.
  248.  * For example, writing a "1" into "addr" and 0x01020304 into "cmap" will
  249.  * set green and blue of color 1 to 0x01 and 0x02 resp. and will set
  250.  * red and green of color 2 to 0x03 and 0x04 resp.!
  251.  *
  252.  * Note: I didn't build these suckers, I just poked at them and guessed
  253.  * the behaviour, and I might be wrong...
  254.  *                      Thorsten von Eicken, 2/19/90
  255.  */
  256.  
  257. /*
  258.  * forward declarations for internal routines
  259.  */
  260. #ifdef sun4c
  261. static int SearchProm _ARGS_((unsigned int node));
  262. #endif
  263. static int GetFBType _ARGS_((void));
  264. static ReturnStatus PutCmap _ARGS_((int whichFb, FBCMap *cmap));
  265. static ReturnStatus GetCmap _ARGS_((int whichFb, FBCMap *cmap));
  266. static ReturnStatus SVideo _ARGS_((int whichFb, int *statePtr));
  267. static ReturnStatus GVideo _ARGS_((int whichFb, int *statePtr));
  268. static ReturnStatus InitCmap _ARGS_((FBDevice *devPtr));
  269.  
  270.  
  271.  
  272.  
  273. /*
  274.  *----------------------------------------------------------------------
  275.  *
  276.  * DevFBOpen --
  277.  *
  278.  *      Open the system frame buffer device.
  279.  *
  280.  * Results:
  281.  *      SUCCESS         - the device was opened.
  282.  *      FAILURE         - something went wrong.
  283.  *
  284.  * Side effects:
  285.  *      The device is opened.
  286.  *
  287.  *----------------------------------------------------------------------
  288.  */
  289. /*ARGSUSED*/
  290. ReturnStatus
  291. DevFBOpen(devicePtr, useFlags, token, flagsPtr)
  292.     Fs_Device    *devicePtr;    /* Device info, unit number, etc. */
  293.     int        useFlags;    /* Flags from the stream being opened. */
  294.     Fs_NotifyToken    token;    /* Call-back token for input, unused here. */
  295.     int        *flagsPtr;    /* OUT: Device open flags. */
  296. {
  297.     FBDevice        *devPtr;
  298.     extern    int    GetFBType();
  299.     FBType    *typePtr;
  300.     int        machArch;
  301.     int        machType;
  302.     int        whichFb = -1;
  303.     struct    eeprom    *eeprom;
  304.     struct    eed_conf    *eeconf;
  305.     int        i;
  306.  
  307.  
  308.     devPtr = (FBDevice *) malloc(sizeof (FBDevice));
  309.     bzero((char *) devPtr, sizeof (FBDevice));
  310.  
  311.     machArch = Mach_GetMachineArch();
  312.     machType = Mach_GetMachineType();
  313.  
  314.     devPtr->type.fb_type = -1;
  315.  
  316.     switch (machArch) {
  317.     case SYS_SUN4:
  318.     if ((machType & SYS_SUN_ARCH_MASK) == SYS_SUN_4_C ) {
  319. #ifndef PROM_1_4
  320.         whichFb = GetFBType();
  321. #else /* PROM_1_4 */
  322.         /*
  323.          * Boing can't handle getting this out of the prom.
  324.          */
  325.         whichFb = FBTYPE_SUN2BW;
  326. #endif /* PROM_1_4 */
  327.         if (whichFb == -1) {
  328.         whichFb = FBTYPE_SUN2BW;
  329.         }
  330.         break;
  331.     }
  332.     /* Fall through for SYS_SUN4. */
  333.     case SYS_SUN3:
  334.     eeprom = (struct eeprom *)EEPROM_BASE;
  335.     eeconf = &(eeprom->ee_diag.eed_conf[0]);
  336.     for (i = 0; i < MAX_SLOTS; i++, eeconf++) {
  337. #ifdef  FOOBAR
  338.         printf("card type %d\n", eeconf->eec_un.eec_type);
  339. #endif  FOOBAR
  340.         /* end of card cage? */
  341.         if (eeconf->eec_un.eec_type == EEC_TYPE_END) {
  342.         break;
  343.         }
  344.         /* color display? */
  345.         if (eeconf->eec_un.eec_type == EEC_TYPE_COLOR) {
  346. #ifdef  FOOBAR
  347.         printf("\tcolor type %d\n",
  348.             eeconf->eec_un.eec_color.eec_color_type);
  349. #endif  FOOBAR
  350.         switch (eeconf->eec_un.eec_color.eec_color_type) {
  351.         case EEC_COLOR_TYPE_CG4:
  352.             whichFb = FBTYPE_SUN4COLOR;
  353.             break;
  354.         case EEC_COLOR_TYPE_CG6:
  355.             whichFb = FBTYPE_SUNFAST_COLOR;
  356.             break;
  357.         default:
  358.             ; /* just ignore... */
  359.         }
  360.         }
  361.         /* b/w display? (note: give preference to color) */
  362.         if (whichFb == -1 && eeconf->eec_un.eec_type == EEC_TYPE_BW) {
  363.         if (eeprom->ee_diag.eed_scrsize == EED_SCR_1600X1280) {
  364.             whichFb = FBTYPE_SUN2BW;
  365.             fbarray[whichFb].fb_height = 1280;
  366.             fbarray[whichFb].fb_width = 1600;
  367.             fbarray[whichFb].fb_size = 256 * 1024;
  368.         } else {
  369.             whichFb = FBTYPE_SUN2BW;
  370.         }
  371.         }
  372.     }
  373.     /* assume b/w as default */
  374.     if (whichFb == -1) {
  375.         whichFb = FBTYPE_SUN2BW;
  376.     }
  377.     if ((whichFb == FBTYPE_SUN2BW) &&
  378.         (eeprom->ee_diag.eed_scrsize == EED_SCR_1600X1280)) {
  379.         whichFb = FBTYPE_SUN2BW;
  380.         fbarray[whichFb].fb_height = 1280;
  381.         fbarray[whichFb].fb_width = 1600;
  382.         fbarray[whichFb].fb_size = 256 * 1024;
  383.     }
  384.     break;
  385.  
  386.     case SYS_DS3100:
  387.     printf("Can't do FB stuff for ds3100's yet.\n");
  388.     return FAILURE;
  389.     default:
  390.     printf("FB stuff won't handle this machine type yet.\n");
  391.     return FAILURE;
  392.     }
  393.  
  394.     if (whichFb < 0 || whichFb >= FBTYPE_LASTPLUSONE) {
  395.     printf("FB type is out of range.\n");
  396.     return FAILURE;
  397.     }
  398.     typePtr = &fbarray[whichFb];
  399.     devPtr->type.fb_type = typePtr->fb_type;
  400.  
  401.     devicePtr->data = (ClientData) devPtr;
  402.  
  403.     return SUCCESS;
  404. }
  405.  
  406.  
  407. /*
  408.  *----------------------------------------------------------------------
  409.  *
  410.  * DevFBIOControl --
  411.  *
  412.  *      Perform device-specific functions with the frame buffer.
  413.  *
  414.  * Results:
  415.  *      GEN_NOT_IMPLEMENTED if io control not supported.  GEN_INVALID_ARG
  416.  *    if something else went wrong.  SUCCESS otherwise, with the type
  417.  *    of the frame buffer described in the out-going buffer.
  418.  *
  419.  * Side effects:
  420.  *      None.
  421.  *
  422.  *----------------------------------------------------------------------
  423.  */
  424. /* ARGSUSED */
  425. ReturnStatus
  426. DevFBIOControl(devicePtr, ioctlPtr, replyPtr)
  427.     Fs_Device    *devicePtr;    /* Handle for device. */
  428.     Fs_IOCParam    *ioctlPtr;    /* Standard I/O Control parameter block. */
  429.     Fs_IOReply    *replyPtr;    /* Size of outBuffer and returned signal. */
  430. {
  431.     FBDevice    *devPtr;
  432.     FBType    *typePtr;
  433.  
  434.     devPtr = (FBDevice *) (devicePtr->data);
  435.  
  436.     switch (ioctlPtr->command) {
  437.     case FBIOGTYPE:
  438.     if (ioctlPtr->outBufSize < sizeof (FBType)) {
  439.         printf("Bad outbuf size.\n");
  440.         return GEN_INVALID_ARG;
  441.     }
  442.     if (devPtr->type.fb_type < 0 ||
  443.         devPtr->type.fb_type >= FBTYPE_LASTPLUSONE) {
  444.         printf("fbtype was bad.\n");
  445.         return FAILURE;
  446.     }
  447.     typePtr = &(fbarray[devPtr->type.fb_type]);
  448.     /* copy to outbuf */
  449.     devPtr->type.fb_height = typePtr->fb_height;
  450.     devPtr->type.fb_width = typePtr->fb_width;
  451.     devPtr->type.fb_depth = typePtr->fb_depth;
  452.     devPtr->type.fb_cmsize = typePtr->fb_cmsize;
  453.     devPtr->type.fb_size = typePtr->fb_size;
  454.  
  455.     bcopy((char *) &(devPtr->type), (char *) ioctlPtr->outBuffer,
  456.         sizeof (FBType));
  457.  
  458.     break;
  459. #ifdef NOTDEF
  460.     /*
  461.      * Does this ioctl really exist?  Is it used?
  462.      */
  463.     case FBIOGINFO:
  464.     if (ioctlPtr->outBufSize < sizeof (FBInfo)) {
  465.         return GEN_INVALID_ARG;
  466.     }
  467.     devPtr->info.fb_physaddr = XX;
  468.     devPtr->info.fb_hwwidth = XX;
  469.     devPtr->info.fb_hwheight = XX;
  470.     devPtr->info.fb_addrdelta = XX;
  471.     devPtr->info.fb_ropaddr = XX;
  472.     devPtr->info.fb_unit = XX;
  473.  
  474.     break;
  475. #endif /* NOTDEF */
  476.     case FBIOPUTCMAP:
  477.     if (ioctlPtr->inBufSize < sizeof (FBCMap)) {
  478.         printf("Bad inbuf size.\n");
  479.         return GEN_INVALID_ARG;
  480.     }
  481.  
  482.     if (devPtr->type.fb_type < 0 ||
  483.         devPtr->type.fb_type >= FBTYPE_LASTPLUSONE) {
  484.         printf("fbtype was bad.\n");
  485.         return FAILURE;
  486.     }
  487.     if (fbCmap == (struct colormap *) NIL) {
  488.         if (InitCmap(devPtr) != SUCCESS) {
  489.         printf("Couldn't initialize colormap.\n");
  490.         return FAILURE;
  491.         }
  492.     }
  493.  
  494.     if (PutCmap(devPtr->type.fb_type,
  495.         (FBCMap *) ioctlPtr->inBuffer) != SUCCESS) {
  496.         return FAILURE;
  497.     }
  498.  
  499.     break;
  500.  
  501.     case FBIOGETCMAP:
  502.     if (ioctlPtr->outBufSize < sizeof (FBCMap)) {
  503.         printf("Bad outbuf size.\n");
  504.         return GEN_INVALID_ARG;
  505.     }
  506.     if (devPtr->type.fb_type < 0 ||
  507.         devPtr->type.fb_type >= FBTYPE_LASTPLUSONE) {
  508.         printf("fbtype was bad.\n");
  509.         return FAILURE;
  510.     }
  511.     if (fbCmap == (struct colormap *) NIL) {
  512.         if (InitCmap(devPtr) != SUCCESS) {
  513.         printf("Couldn't initialize colormap.\n");
  514.         return FAILURE;
  515.         }
  516.     }
  517.     if (GetCmap(devPtr->type.fb_type,
  518.         (FBCMap *) ioctlPtr->outBuffer) != SUCCESS) {
  519.         return FAILURE;
  520.     }
  521.  
  522.     break;
  523.  
  524.     case FBIOSVIDEO:
  525.     if (ioctlPtr->inBufSize < sizeof (int)) {
  526.         printf("Bad inbuf size.\n");
  527.         return GEN_INVALID_ARG;
  528.     }
  529.  
  530.     if (devPtr->type.fb_type < 0 ||
  531.         devPtr->type.fb_type >= FBTYPE_LASTPLUSONE) {
  532.         printf("fbtype was bad.\n");
  533.         return FAILURE;
  534.     }
  535.  
  536.     /*
  537.      * If the display is a color display, initialize the color map first.
  538.      */
  539.     switch (devPtr->type.fb_type) {
  540.     case FBTYPE_SUN1COLOR:
  541.     case FBTYPE_SUN2COLOR:
  542.     case FBTYPE_SUN2GP:        /* color? */
  543.     case FBTYPE_SUN5COLOR:
  544.     case FBTYPE_SUN3COLOR:
  545.     case FBTYPE_MEMCOLOR:
  546.     case FBTYPE_SUN4COLOR:
  547.     case FBTYPE_SUNFAST_COLOR:
  548.     case FBTYPE_SUNROP_COLOR:
  549.     case FBTYPE_SUNFB_VIDEO:    /* color? */
  550.         if (fbCmap == (struct colormap *) NIL) {
  551.         if (InitCmap(devPtr) != SUCCESS) {
  552.             printf("Couldn't initialize colormap.\n");
  553.             return FAILURE;
  554.         }
  555.         }
  556.         break;
  557.     default:
  558.         /* Do nothing. */
  559.         break;
  560.     }
  561.  
  562.     if (SVideo(devPtr->type.fb_type,
  563.         (int *) ioctlPtr->inBuffer) != SUCCESS) {
  564.         return FAILURE;
  565.     }
  566.  
  567.     break;
  568.  
  569.     case FBIOGVIDEO:
  570.     if (ioctlPtr->outBufSize < sizeof (int)) {
  571.         printf("Bad outbuf size.\n");
  572.         return GEN_INVALID_ARG;
  573.     }
  574.  
  575.     if (devPtr->type.fb_type < 0 ||
  576.         devPtr->type.fb_type >= FBTYPE_LASTPLUSONE) {
  577.         printf("fbtype was bad.\n");
  578.         return FAILURE;
  579.     }
  580.     /*
  581.      * If the display is a color display, initialize the color map first.
  582.      */
  583.     switch (devPtr->type.fb_type) {
  584.     case FBTYPE_SUN1COLOR:
  585.     case FBTYPE_SUN2COLOR:
  586.     case FBTYPE_SUN2GP:        /* color? */
  587.     case FBTYPE_SUN5COLOR:
  588.     case FBTYPE_SUN3COLOR:
  589.     case FBTYPE_MEMCOLOR:
  590.     case FBTYPE_SUN4COLOR:
  591.     case FBTYPE_SUNFAST_COLOR:
  592.     case FBTYPE_SUNROP_COLOR:
  593.     case FBTYPE_SUNFB_VIDEO:    /* color? */
  594.         if (fbCmap == (struct colormap *) NIL) {
  595.         if (InitCmap(devPtr) != SUCCESS) {
  596.             printf("Couldn't initialize colormap.\n");
  597.             return FAILURE;
  598.         }
  599.         }
  600.         break;
  601.     default:
  602.         /* Do nothing. */
  603.         break;
  604.     }
  605.  
  606.     if (GVideo(devPtr->type.fb_type,
  607.         (int *) ioctlPtr->outBuffer) != SUCCESS) {
  608.         return FAILURE;
  609.     }
  610.     
  611.     break;
  612.  
  613.     case FBIOSATTR:
  614.     case FBIOGATTR:
  615. #ifdef NOTDEF
  616.     case FBIOGVERTICAL:
  617. #endif NOTDEF
  618.     printf("Not implemented.\n");
  619.     return GEN_NOT_IMPLEMENTED;
  620.     default:
  621.     printf("Default: invalid arg.\n");
  622.     return GEN_INVALID_ARG;
  623.     }
  624.     return SUCCESS;
  625. }
  626.  
  627.  
  628. /*
  629.  *----------------------------------------------------------------------
  630.  *
  631.  * DevFBClose --
  632.  *
  633.  *      Close the frame buffer.
  634.  *
  635.  * Results:
  636.  *      SUCCESS         - always returned.
  637.  *
  638.  * Side effects:
  639.  *      The frame buffer is "closed".
  640.  *
  641.  *----------------------------------------------------------------------
  642.  */
  643. /* ARGSUSED */
  644. ReturnStatus
  645. DevFBClose(devicePtr, useFlags, openCount, writerCount)
  646.     Fs_Device   *devicePtr;        /* Information about device. */
  647.     int         useFlags;        /* Indicates whether stream being
  648.                      * closed was for reading and/or
  649.                      * writing:  OR'ed combination of
  650.                      * FS_READ and FS_WRITE. */
  651.     int         openCount;        /* # of times this particular stream
  652.                      * is still open. */
  653.     int         writerCount;        /* # of times this particular stream
  654.                      * is still open for writing. */
  655. {
  656.     if ((openCount == 0) && (devicePtr->data != (ClientData) NIL)) { 
  657.     free((Address) devicePtr->data);
  658.     }
  659.  
  660.     return SUCCESS;
  661. }
  662.  
  663. char    searchBuffer[1024];
  664.  
  665.  
  666. /*
  667.  *----------------------------------------------------------------------
  668.  *
  669.  * SearchProm --
  670.  *
  671.  *    Search through the prom devices to find which frame buffer we have.
  672.  *
  673.  * Results:
  674.  *    The frame buffer type.
  675.  *
  676.  * Side effects:
  677.  *    Info about the device from the prom gets put into the fb table.
  678.  *
  679.  *----------------------------------------------------------------------
  680.  */
  681. #ifdef sun4c
  682. static int
  683. SearchProm(node)
  684.     unsigned    int        node;
  685. {
  686.     unsigned    int        newNode;
  687.     int        length = 0;
  688.     struct    config_ops    *configPtr;
  689.     int        i;
  690.     int        whichFb;
  691.  
  692.     configPtr = romVectorPtr->v_config_ops;
  693.     while (node != 0) {
  694.     length = configPtr->devr_getproplen(node, "name");
  695.     if (length > 0) {
  696.         if (length > sizeof (searchBuffer)) {
  697.         panic("SearchProm: buffer too small.\n");
  698.         }
  699.         configPtr->devr_getprop(node, "name", searchBuffer);
  700.         for (i = 0; i < FBTYPE_LASTPLUSONE; i++) {
  701.         if (strcmp(searchBuffer, fbNames[i]) == 0) {
  702.             whichFb = i;
  703.             /* fill it in */
  704.             length = configPtr->devr_getproplen(node, "address");
  705.             if (length <= 0) {
  706.             printf("No address found for frame buffer in prom.\n");
  707.             } else {
  708.             configPtr->devr_getprop(node, "address", searchBuffer);
  709.             if (fbaddrs[i].fb_buffer !=
  710.                 (void *) (*(int *) searchBuffer)) {
  711. #ifdef DEBUG
  712.                 printf("Updating address for %s to 0x%x.\n",
  713.                     fbNames[whichFb], *(int *) searchBuffer);
  714. #endif /* DEBUG */
  715.                 fbaddrs[i].fb_buffer =
  716.                     (void *) (*(int *) searchBuffer);
  717.             }
  718.             }
  719.             length = configPtr->devr_getproplen(node, "height");
  720.             if (length <= 0) {
  721.             printf("No height found for frame buffer in prom.\n");
  722.             } else {
  723.             configPtr->devr_getprop(node, "height", searchBuffer);
  724.             if (fbarray[i].fb_height != *(int *) searchBuffer) {
  725. #ifdef DEBUG
  726.                 printf("Updating height for %s to 0x%x.\n",
  727.                     fbNames[whichFb], *(int *) searchBuffer);
  728. #endif /* DEBUG */
  729.                 fbarray[i].fb_height = *(int *) searchBuffer;
  730.             }
  731.             }
  732.             length = configPtr->devr_getproplen(node, "width");
  733.             if (length <= 0) {
  734.             printf("No width found for frame buffer in prom.\n");
  735.             } else {
  736.             configPtr->devr_getprop(node, "width", searchBuffer);
  737.             if (fbarray[i].fb_width != *(int *) searchBuffer) {
  738. #ifdef DEBUG
  739.                 printf("Updating width for %s to 0x%x.\n",
  740.                     fbNames[whichFb], *(int *) searchBuffer);
  741. #endif /* DEBUG */
  742.                 fbarray[i].fb_width = *(int *) searchBuffer;
  743.             }
  744.             }
  745.             length = configPtr->devr_getproplen(node, "depth");
  746.             if (length <= 0) {
  747.             printf("No depth found for frame buffer in prom.\n");
  748.             } else {
  749.             configPtr->devr_getprop(node, "depth", searchBuffer);
  750.             if (fbarray[i].fb_depth != *(int *) searchBuffer) {
  751. #ifdef DEBUG
  752.                 printf("Updating depth for %s to 0x%x.\n",
  753.                     fbNames[whichFb], *(int *) searchBuffer);
  754. #endif /* DEBUG */
  755.                 fbarray[i].fb_depth = *(int *) searchBuffer;
  756.             }
  757.             }
  758.             return whichFb;
  759.         }
  760.         }
  761.     }
  762.     newNode = configPtr->devr_child(node);
  763.     whichFb = SearchProm(newNode);
  764.     if (whichFb >= 0) {
  765.         return whichFb;
  766.     }
  767.     node = configPtr->devr_next(node);
  768.     }
  769.     return -1;
  770. }
  771. #endif /* sun4c */
  772.  
  773.  
  774. /*
  775.  *----------------------------------------------------------------------
  776.  *
  777.  * GetFBType --
  778.  *
  779.  *    Temporary routine to find frame buffer type from a file rather than
  780.  *    from the prom.
  781.  *
  782.  * Results:
  783.  *    Integer representing frame buffer type.
  784.  *
  785.  * Side effects:
  786.  *    None.
  787.  *
  788.  *----------------------------------------------------------------------
  789.  */
  790. static int
  791. GetFBType()
  792. {
  793. #ifdef sun4c
  794.     struct    config_ops    *configPtr;
  795.     unsigned    int        node;
  796.  
  797.     configPtr = romVectorPtr->v_config_ops;
  798.     /*
  799.      * Find a frame buffer type:  First get the root node id of the tree of
  800.      * devices in the prom.  Then traverse it depth-first to find some frame
  801.      * buffer.
  802.      */
  803.     node = configPtr->devr_next(0);
  804.  
  805.     return SearchProm(node);
  806. #else
  807.     return -1;
  808. #endif /* sun4c */
  809. }
  810.  
  811.  
  812.  
  813. /*
  814.  *----------------------------------------------------------------------
  815.  *
  816.  * DevFBMMap --
  817.  *
  818.  *    Map a device into user space.
  819.  *
  820.  * Results:
  821.  *    SUCCESS or FAILURE.
  822.  *
  823.  * Side effects:
  824.  *    Device area made accessible to user.
  825.  *
  826.  *----------------------------------------------------------------------
  827.  */
  828. /*ARGSUSED*/
  829. ReturnStatus
  830. DevFBMMap(devicePtr, startAddr, length, offset, newAddrPtr)
  831.     Fs_Device    *devicePtr;
  832.     Address    startAddr;
  833.     int        length;
  834.     int        offset;
  835.     Address    *newAddrPtr;
  836. {
  837.     FBDevice    *devPtr;
  838.     Address    kernelAddr;    /* Virtual address in kernel of device. */
  839.     Address    kernelAlignedAddr;    /* Aligned virtual addr in kernel. */
  840.     int        numBytes;
  841.     ReturnStatus    status;
  842.  
  843.     devPtr = (FBDevice *) (devicePtr->data);
  844.  
  845.     kernelAddr = (Address) (fbaddrs[devPtr->type.fb_type].fb_buffer);
  846.     if (kernelAddr == (Address) NIL) {
  847.     printf("FB device has no kernel address.\n");
  848.     return FAILURE;
  849.     }
  850.     /*
  851.      * Must align user address forwards rather than backwards.  They must
  852.      * have allocated an extra segment.
  853.      */
  854.     kernelAlignedAddr = (Address)
  855.         (((unsigned int)kernelAddr) & ~(VMMACH_SEG_SIZE - 1));
  856.     numBytes = ((unsigned int)((kernelAddr + length) - kernelAlignedAddr) +
  857.         (VMMACH_SEG_SIZE - 1)) & ~(VMMACH_SEG_SIZE - 1);
  858.     status = VmMach_IntMapKernelIntoUser((unsigned int) kernelAlignedAddr,
  859.         numBytes, (unsigned int) startAddr, newAddrPtr);
  860.     if (status != SUCCESS) {
  861.     return status;
  862.     }
  863. #ifdef DEBUG
  864.     printf("Real VA would be 0x%x\n", *newAddrPtr);
  865. #endif /* DEBUG */
  866.  
  867.     return SUCCESS;
  868. }
  869.  
  870.  
  871.  
  872. /*
  873.  *----------------------------------------------------------------------
  874.  *
  875.  * PutCmap --
  876.  *
  877.  *    Update the hardware colormap.
  878.  *
  879.  * Results:
  880.  *    SUCCESS or FAILURE.
  881.  *
  882.  * Side effects:
  883.  *    Memory updated.
  884.  *
  885.  *----------------------------------------------------------------------
  886.  */
  887. static ReturnStatus
  888. PutCmap(whichFb, cmap)
  889.     int        whichFb;
  890.     FBCMap    *cmap;
  891. {
  892.     unsigned char   *uPtr;
  893.     unsigned int    *iPtr;
  894.     int             c;
  895.     int             index = cmap->index;
  896.     int             count = cmap->count;
  897.     unsigned char   *rmap = cmap->red;
  898.     unsigned char   *gmap = cmap->green;
  899.     unsigned char   *bmap = cmap->blue;
  900.  
  901.     if(index < 0) {
  902.     printf("cmap index was < 0.\n");
  903.     return FAILURE;
  904.     }
  905.  
  906.     /* Handle colors 0..255 */
  907.     if (index >= 0 && index < 256) {
  908.     if (index+count > 256) {
  909.         count = 256 - index;
  910.     }
  911.     if (whichFb == FBTYPE_SUN4COLOR || whichFb == FBTYPE_SUN3COLOR) {
  912.         /* update the memory copy */
  913.         uPtr = &fbCmapCopy.map[index][0];
  914.         c = count;
  915.         while (c--) {
  916.         *uPtr++ = *rmap++;
  917.         *uPtr++ = *gmap++;
  918.         *uPtr++ = *bmap++;
  919.         }
  920.  
  921.         /* update DAC: weird 4/3 entries per word mapping */
  922. #define D4M3(x) ((((x)>>2)<<1) + ((x)>>2))      /* (x/4)*3 */
  923. #define D4M4(x) ((x)&~0x3)                      /* (x/4)*4 */
  924.         iPtr = &fbCmapCopy.raw[D4M3(index)];
  925.         c = D4M3(index+count-1) - D4M3(index) + 3;
  926.         fbCmap->addr = D4M4(index);
  927.         while (c--) {
  928.         fbCmap->cmap = *iPtr++;
  929.         }
  930.     } else { /* FBTYPE_SUNFAST_COLOR */
  931.         /* update the chip */
  932.         fbCmap->addr = index << 24;
  933.         c = count;
  934.         while (c--) {
  935.         fbCmap->cmap = (unsigned int)(*rmap++) << 24;
  936.         fbCmap->cmap = (unsigned int)(*gmap++) << 24;
  937.         fbCmap->cmap = (unsigned int)(*bmap++) << 24;
  938.         }
  939.     }
  940.  
  941.     /* What's left? */
  942.     index += count;
  943.     count = cmap->count-count;
  944.     }
  945.  
  946.     /* Any overlay color changes? */
  947.     if (index >= 256 && count > 0) {
  948. /******* dunno how to do that */
  949.     }
  950.     return SUCCESS;
  951. }
  952.  
  953.  
  954. /*
  955.  *----------------------------------------------------------------------
  956.  *
  957.  * GetCmap --
  958.  *
  959.  *    Return the hardware colormap.
  960.  *
  961.  * Results:
  962.  *    SUCCESS or FAILURE.
  963.  *
  964.  * Side effects:
  965.  *    Memory updated.
  966.  *
  967.  *----------------------------------------------------------------------
  968.  */
  969. static ReturnStatus
  970. GetCmap(whichFb, cmap)
  971.     int        whichFb;
  972.     FBCMap    *cmap;
  973. {
  974.     unsigned char   *uPtr;
  975.     int             c;
  976.     int             index = cmap->index;
  977.     int             count = cmap->count;
  978.     unsigned char   *rmap = cmap->red;
  979.     unsigned char   *gmap = cmap->green;
  980.     unsigned char   *bmap = cmap->blue;
  981.  
  982.     if(index < 0) {
  983.     return FAILURE;
  984.     }
  985.  
  986.     /* Handle colors 0..255 */
  987.     if(index >= 0 && index < 256) {
  988.     if(index+count > 256) {
  989.         count = 256 - index;
  990.     }
  991.     if (whichFb == FBTYPE_SUN4COLOR || whichFb == FBTYPE_SUN3COLOR) {
  992.         /* copy from the memory copy */
  993.         uPtr = &fbCmapCopy.map[index][0];
  994.         c = count;
  995.         while(c--) {
  996.         *rmap++ = *uPtr++;
  997.         *gmap++ = *uPtr++;
  998.         *bmap++ = *uPtr++;
  999.         }
  1000.     } else { /* FBTYPE_SUNFAST_COLOR */
  1001.         /* get it from the chip */
  1002.         fbCmap->addr = index << 24;
  1003.         c = count;
  1004.         while(c--) {
  1005.         *rmap++ = (unsigned char)(fbCmap->cmap >> 24);
  1006.         *gmap++ = (unsigned char)(fbCmap->cmap >> 24);
  1007.         *bmap++ = (unsigned char)(fbCmap->cmap >> 24);
  1008.         }
  1009.     }
  1010.  
  1011.     /* What's left? */
  1012.     index += count;
  1013.     count = cmap->count-count;
  1014.     }
  1015.  
  1016.     /* Any overlay color requested? */
  1017.     if(index >= 256 && count > 0) {
  1018. /******* dunno how to do that */
  1019.     }
  1020.  
  1021.     return SUCCESS;
  1022. }
  1023.  
  1024. /*
  1025.  *----------------------------------------------------------------------
  1026.  *
  1027.  * SVideo --
  1028.  *
  1029.  *    Turn on or off the video.
  1030.  *
  1031.  * Results:
  1032.  *    SUCCESS or FAILURE.
  1033.  *
  1034.  * Side effects:
  1035.  *    Video turned on or off.
  1036.  *
  1037.  *----------------------------------------------------------------------
  1038.  */
  1039. static ReturnStatus
  1040. SVideo(whichFb, statePtr)
  1041.     int        whichFb;
  1042.     int        *statePtr;
  1043. {
  1044.     int        onOff;
  1045.  
  1046.     onOff = *statePtr;
  1047.     switch (whichFb) {
  1048.     case FBTYPE_SUN2BW:
  1049. /******* dunno how to do that */
  1050.     return SUCCESS;
  1051.     case FBTYPE_SUN4COLOR:
  1052.     case FBTYPE_SUNFAST_COLOR:
  1053.     case FBTYPE_SUN3COLOR:
  1054.     /* get colormap access */
  1055.     if(fbCmap == (struct colormap *) NIL) {
  1056.         printf("Colormap not yet set.\n");
  1057.         return FAILURE;
  1058.     }
  1059.  
  1060.     /* Twiddle command registers to turn video off */
  1061.     if (onOff) {
  1062.          onOff = ~0;
  1063.     }
  1064.     if(whichFb == FBTYPE_SUNFAST_COLOR) {
  1065.         fbCmap->addr = 0x04 << 24;      /* read mask */
  1066.         fbCmap->ctrl = onOff;           /* color planes */
  1067.     } else {
  1068.         /* overlay off for blanking */
  1069.         fbCmap->addr = 0x06;            /* command reg */
  1070.         fbCmap->ctrl = 0x70|(onOff&3);  /* overlay plane */
  1071.         /* read mask off for blanking */
  1072.         fbCmap->addr = 0x04;            /* read mask */
  1073.         fbCmap->ctrl = onOff;           /* color planes */
  1074.         if(!onOff) {
  1075.         /* color 0 -> black for blanking */
  1076.         fbCmap->addr = 0x00;
  1077.         fbCmap->cmap = 0x00000000;
  1078.         } else {
  1079.         /* restore colors */
  1080.         fbCmap->addr = 0x00;
  1081.         fbCmap->cmap = fbCmapCopy.raw[0];
  1082.         fbCmap->cmap = fbCmapCopy.raw[1];
  1083.         fbCmap->cmap = fbCmapCopy.raw[2];
  1084.         }
  1085.     }
  1086.     return SUCCESS;
  1087.     default:
  1088.     return FAILURE;
  1089.     }
  1090. }
  1091.  
  1092. /*
  1093.  *----------------------------------------------------------------------
  1094.  *
  1095.  * GVideo --
  1096.  *
  1097.  *    Get the on/off status of the video.
  1098.  *
  1099.  * Results:
  1100.  *    SUCCESS or FAILURE.
  1101.  *
  1102.  * Side effects:
  1103.  *    Video status returned in out parameter.
  1104.  *
  1105.  *----------------------------------------------------------------------
  1106.  */
  1107. static ReturnStatus
  1108. GVideo(whichFb, statePtr)
  1109.     int        whichFb;
  1110.     int        *statePtr;
  1111. {
  1112.     int        rmask;
  1113.  
  1114.     switch (whichFb) {
  1115.     case FBTYPE_SUN2BW:
  1116.     /* Don't know how to do this one. */
  1117.     return SUCCESS;
  1118.     case FBTYPE_SUN4COLOR:
  1119.     case FBTYPE_SUNFAST_COLOR:
  1120.     case FBTYPE_SUN3COLOR:
  1121.     /* get colormap access */
  1122.     if(fbCmap == (struct colormap *) NIL) {
  1123.         printf("Colormap not yet set.\n");
  1124.         return FAILURE;
  1125.     }
  1126.     /* Look hard at the control registers */
  1127.     if(whichFb == FBTYPE_SUNFAST_COLOR) {
  1128.         fbCmap->addr = 0x04 << 24;      /* read mask */
  1129.         rmask = fbCmap->ctrl >> 24;     /* color planes */
  1130.     } else {
  1131.         fbCmap->addr = 0x04;            /* read mask */
  1132.         rmask = fbCmap->ctrl;           /* color planes */
  1133.     }
  1134.     *statePtr = (rmask & 0xff) ? 1 : 0;
  1135.     break;
  1136.     default:
  1137.     return FAILURE;
  1138.     }
  1139.     return SUCCESS;
  1140. }
  1141.  
  1142. /*
  1143.  *----------------------------------------------------------------------
  1144.  *
  1145.  * InitCmap --
  1146.  *
  1147.  *    Initialize the colormap.
  1148.  *
  1149.  * Results:
  1150.  *    SUCCESS or FAILURE.
  1151.  *
  1152.  * Side effects:
  1153.  *    Colormap data structures initialized.
  1154.  *
  1155.  *----------------------------------------------------------------------
  1156.  */
  1157. static ReturnStatus
  1158. InitCmap(devPtr)
  1159.     FBDevice    *devPtr;
  1160. {
  1161.     int        c;
  1162.     int        whichFb;
  1163.  
  1164.     whichFb = devPtr->type.fb_type;
  1165.     fbCmap = fbaddrs[whichFb].fb_cmap;
  1166.  
  1167.     if (whichFb != FBTYPE_SUN4COLOR && whichFb != FBTYPE_SUNFAST_COLOR &&
  1168.         whichFb != FBTYPE_SUN3COLOR) {
  1169.     printf("Wrong fb type to have a colormap.\n");
  1170.     return FAILURE;
  1171.     }
  1172.     /* Init colormap copy, overlay, etc.. */
  1173.     if(whichFb == FBTYPE_SUNFAST_COLOR) {
  1174.     fbCmap->addr = 0x06 << 24;      /* command register address */
  1175.     fbCmap->ctrl = 0x70 << 24;      /* disable cursor overlay */
  1176.     } else {
  1177.     for (c = 0; c < 256 * 3 / 4; c++) {
  1178.         fbCmapCopy.raw[c] = fbCmap->cmap;
  1179.     }
  1180.     fbCmap->addr = 0x06;            /* command register address */
  1181.     fbCmap->ctrl = 0x73;            /* enable overlay */
  1182.     /* set overlay colors: bg: blue, fg: white */
  1183.     fbCmap->addr = 0x00;
  1184.     fbCmap->omap = 0x00000000;
  1185.     fbCmap->omap = 0x00ff0000;
  1186.     fbCmap->omap = 0x00ffffff;
  1187.     }
  1188.  
  1189.     return SUCCESS;
  1190. }
  1191.